![]() |
PATH![]() |
![]() ![]() |
The result of a command is the value generated when the command is executed. You can display the result of a command in the Script Editor by using the Show Result command from the Controls menu to open the result window. For example, if you run the following script,
tell application "Finder"
duplicate folder "Apple Extras" of startup disk
end tell
and then choose Show Result in the Script Editor, you'll see a value similar to
folder "Apple Extras copy" of disk "Hard Disk" of application "Finder"
The term startup disk is one of several special folder and disk names that the Finder understands. Others include apple menu items folder , control panels folder , desktop , extensions folder , fonts folder , preferences folder, and system folder . You can read more about scripting the Finder in the AppleScript section of the Mac OS Help Center.
Some commands return a result as a value. For example, the Count command in the following statement returns a value: the number of files (not including folders or files enclosed in folders) in the specified folder.
tell application "Finder"
count files in folder "Apple Extras" of startup disk
end tell
You can use this statement anywhere a value is required by enclosing the statement in parentheses. For example, the following statement sets the value of numFiles to the value returned by the Count command.
tell application "Finder"
set numFiles to ¬
(count files in folder "Apple Extras" of startup disk)
end tell
For more information on how to use the Script Editor, see the AppleScript section of the Mac OS Help Center.